package com.zzyl.nursing.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.zzyl.nursing.domain.NursingPlan;
import com.zzyl.nursing.dto.QueryParamsDTO;
import com.zzyl.nursing.mapper.MemberOrderMapper;
import com.zzyl.nursing.service.IMemberOrderService;
import com.zzyl.nursing.vo.NursingServiceResponseVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class MemberOrderServiceImpl implements IMemberOrderService {
    @Autowired
    private MemberOrderMapper memberOrderMapper;
    @Override
    public NursingServiceResponseVO projectPage(QueryParamsDTO dto) {

        NursingServiceResponseVO vo = null;
        try {
            PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
            List<NursingPlan>   records=memberOrderMapper.projectPage(dto);
            Page<NursingPlan> page = (Page<NursingPlan>) records;
            vo = new NursingServiceResponseVO();
            vo.setTotal((int) page.getTotal());
            vo.setRows(page.getResult());
        } catch (Exception e) {
            log.error("查询异常",e);
        }

        return vo;





    }
}
